package com.pocket.insight.base.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * @author zhaozhile
 */
@Getter
@AllArgsConstructor
public enum ResponseCodeEnum {

    SYS_ERROR(-1L, "error/sys_error"),
    ERROR(100L, "error"),
    SUCCESS(200L, "success"),
    BAD_REQUEST(400L, "error/bad_request"),



    ERROR_DATABASE_NOT_SUPPORTED(10064L, "error/database-not-supported"),
    ;

    private Long code;
    private String msgKey;


    public static String getMsg(Long code) {
        for (ResponseCodeEnum e : ResponseCodeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getMsgKey();
            }
        }
        return "系统异常";
    }

}
